/*
 * @Author: sunzhijun 
 * @Date: 2019-11-05 10:00:58 
 * @Last Modified by: sunzhijun
 * @Last Modified time: 2019-11-05 10:30:47
 */
export default class pagination {
    constructor (comp){
        this.comp = comp;
        this.dispatch = this.comp.props.dispatch;
    }
    //列表翻页事件
    changePaginationFn = async (pageIndex)=>{
        const { props, action } = this.comp;
        let { main: { pageInfo }} = props;
        pageInfo.pageIndex = pageIndex;
        // this.props.changePagination && this.props.changePagination(pageInfo);
        await this.dispatch({
            type: 'main/update',
            payload: {
                pageInfo
            }
        })
        action.tableAct.getTableData();
    }

    // 每页显示条数
    pageSizeSelect = async (val) =>{
        const { props, action } = this.comp;
        let { main: { pageInfo }} = props;
        pageInfo.pageSize = val;
        await this.dispatch({
            type: 'main/update',
            payload: {
                pageInfo
            }
        })
        action.tableAct.getTableData();
    }
}